From 8a671dd0ecf1f91f06d6913538742085fefe9990 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Tue, 23 Apr 2024 16:13:43 +0700
Subject: Fix whatsapp url on basic layout

---
 src-migrate/pages/shop/product/[slug].tsx | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

(limited to 'src-migrate/pages/shop/product/[slug].tsx')

diff --git a/src-migrate/pages/shop/product/[slug].tsx b/src-migrate/pages/shop/product/[slug].tsx
index 733e10d9..fc72a6b0 100644
--- a/src-migrate/pages/shop/product/[slug].tsx
+++ b/src-migrate/pages/shop/product/[slug].tsx
@@ -1,5 +1,5 @@
 import { GetServerSideProps, NextPage } from 'next'
-import React from 'react'
+import React, { useEffect } from 'react'
 import dynamic from 'next/dynamic'
 import cookie from 'cookie'
 
@@ -9,6 +9,7 @@ import { IProductDetail } from '~/types/product'
 
 import { Seo } from '~/components/seo'
 import { useRouter } from 'next/router'
+import { useProductContext } from '@/contexts/ProductContext'
 
 const BasicLayout = dynamic(() => import('@/core/components/layouts/BasicLayout'), { ssr: false })
 const ProductDetail = dynamic(() => import('~/modules/product-detail'), { ssr: false })
@@ -40,6 +41,12 @@ const SELF_HOST = process.env.NEXT_PUBLIC_SELF_HOST
 const ProductDetailPage: NextPage<PageProps> = ({ product }) => {
   const router = useRouter();
 
+  const { setProduct } = useProductContext();
+
+  useEffect(() => {
+    if (product) setProduct(product);
+  }, [product, setProduct]);
+
   return (
     <BasicLayout>
       <Seo
-- 
cgit v1.2.3

